package game;

public class Account {
		
		protected int beholdning;
		
		public Account() {
			beholdning=3000;
		}
		
		public void deposit(int beloeb) {
			if (beloeb>=0)
			beholdning += beloeb;
		}
		
		public void withdraw(int belob)
		{
			if (belob<0) belob=(belob*(-1));
			beholdning -= belob;
			if (beholdning<0) {
				beholdning=0;
			}
		}
		
		public void transfer(int belob, Player sp)
		{
			withdraw(belob);
			sp.deposit(belob);
		}
		
		public int getAccount() {
			return beholdning;
		}
		
		public void nulstil() {
			beholdning=0;
		}
		// Test
}
